package com.hgkj.cloud.base.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hgkj.cloud.base.dao.SysTestingQuestionTypeMapper;
import com.hgkj.cloud.base.domain.SysTestingQuestionType;
import com.hgkj.cloud.base.service.SysTestingQuestionTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysTestingQuestionTypeServiceImpl implements SysTestingQuestionTypeService {

    @Autowired
    private SysTestingQuestionTypeMapper sysTestingQuestionTypeMapper;

    @Override
    public List<SysTestingQuestionType> listTodayRecommend() {
        return sysTestingQuestionTypeMapper.listTodayRecommend();
    }

    @Override
    public Page<SysTestingQuestionType> getChildQuestionType(Integer pageNum, Integer pageSize, Map<String, Object> map) {
        PageHelper.startPage(pageNum,pageSize);
        return sysTestingQuestionTypeMapper.getChildQuestionType(map);
    }

    @Override
    public List<SysTestingQuestionType> getChildQuestionTypesByParentId(Integer parentId) {
        return sysTestingQuestionTypeMapper.getChildQuestionTypesByParentId(parentId);
    }

    @Override
    public int updatePercentageAndPraise(Map<String, Object> map) {
        return sysTestingQuestionTypeMapper.updatePercentageAndPraise(map);
    }

    @Override
    public SysTestingQuestionType getTestQuestionTypeById(Integer typeId) {
        return sysTestingQuestionTypeMapper.getTestQuestionTypeById(typeId);
    }


    @Override
    public Page<SysTestingQuestionType> getFavoriteByUser(Integer pageNum, Integer pageSize, String userUuid) {
        PageHelper.startPage(pageNum,pageSize);
        return sysTestingQuestionTypeMapper.getFavoriteByUser(userUuid);
    }

    @Override
    public int getCountForTesting(Map<String, Object> map) {
        return sysTestingQuestionTypeMapper.getCountForTesting(map);
    }

    @Override
    public List<SysTestingQuestionType> getChildQuestionTypesNoParentId() {
        return sysTestingQuestionTypeMapper.getChildQuestionTypesNoParentId();
    }


    @Override
    public List<SysTestingQuestionType> getChildQuestionType(Integer parentId) {
        // TODO Auto-generated method stub
        return sysTestingQuestionTypeMapper.getChildQuestionTypesByParentId(parentId);
    }

    @Override
    public int insertQuestionType(SysTestingQuestionType type) {
        return sysTestingQuestionTypeMapper.insertQuestionType(type);
    }

    @Override
    public List<Map> getAllTest(Integer page,Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        return sysTestingQuestionTypeMapper.getAllTest();
    }

    @Override
    public Map getTestById(Long id) {
        return sysTestingQuestionTypeMapper.getTestById(id);
    }

    @Override
    public void updatetest(Map map) {
        sysTestingQuestionTypeMapper.updatetest(map);
    }
}
